package cz.muni.fi.pa165.rentalofconstructionmachinery.dao;

import cz.muni.fi.pa165.rentalofconstructionmachinery.entity.Customer;
import cz.muni.fi.pa165.rentalofconstructionmachinery.entity.Machine;
import cz.muni.fi.pa165.rentalofconstructionmachinery.entity.Rental;
import java.util.List;

/**
 *
 * @author David Domonkos
 */
public interface RentalDAO {
    
    /**
     * Persist a new rental. Neither its customer nor machine may be null!
     * 
     * @param rental The rental entity. Must not be null!
     */
    public void createRental(Rental rental);
    
    /**
     * Delete rental from the database.
     * 
     * @param rental The rental entity. Must not be null!
     */
    public void deleteRental(Rental rental);
    
    /**
     * Update rental in the database.
     * 
     * @param rental The rental entity. Must not be null!
     */
    public void updateRental(Rental rental);
    
    /**
     * Fetch all rentals from the database.
     * 
     * @return List of all existing rentals.
     */
    public List<Rental> getAllRentals();
    
    /**
     * Get a rental by its ID.
     * 
     * @param id Must not be null!
     * @return Null, if rental with such ID does not exist.
     */
    public Rental getRentalById(Long id);
    
    /**
     * Get all rentals associated with a specified customer.
     * 
     * @param customer Must not be null.
     * @return List of rentals.
     */
    public List<Rental> getRentalsByCustomer(Customer customer);
    
    /**
     * Get all rentals associated with a specified machine.
     * 
     * @param machine Must not be null.
     * @return List of rentals.
     */
    public List<Rental> getRentalsByMachine(Machine machine);
}
